<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class OANote extends Model
{
    protected $table = 'note';
    protected $fillable = [
        'pid',
        'type',
        'ctime',
        'title',
        'note',
        'is_del',
        'roleid',
        'uid',
    ];
    public $timestamps = false;

    public static $typeList = [
        'lx'=>'立项',
        'ys'=>'预算',
        'js'=>'结算',
        'cw'=>'财务',
        'xz'=>'行政'
    ];

    public function files()
    {
        return $this->hasMany(OANoteFiles::class,'pid');
    }

    public function getTypeNameAttribute()
    {
        return self::$typeList[$this->type] ?? '立项';
    }
}
